package tests;


import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;


import business.CalendarDate;
import business.PessoaPrototype;

public class PessoaPrototypeTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}
	//aiming for exceptions will cause the JUnit Coverage to lower, but will give a better
	//coverage on the main code (and that's the code we really are testin, so, it's ok
	
	@Test 
	public void constructTest(){
		PessoaPrototype p = new PessoaPrototype();
		PessoaPrototype p2 = new PessoaPrototype("John Doe", new CalendarDate(11,11,1990), "john@doe.com");
		
		
		
		
	}
	
	@Test (expected = AssertionError.class)
	public void constructAssertTest1(){
		PessoaPrototype p4 = new PessoaPrototype("John Doe", new CalendarDate(11,11,2013), "john@doe.com");
	}
	
	@Test (expected = AssertionError.class)
	public void constructAssertTest2(){
		PessoaPrototype p3 = new PessoaPrototype(null, null, null);
	}
	
	
	@Test
	public void getterTest(){
		PessoaPrototype p = new PessoaPrototype();
		p.getClass();
		p.getDataNascimento();
		p.getEmail();
		p.getNome();
	}
	
	@Test
	public void setterTest(){
		PessoaPrototype p = new PessoaPrototype();
		p.setDataNascimento(new CalendarDate());
		p.setEmail("john@doe.com");
		p.setNome("John Doe");
	}
	
	@Test (expected=AssertionError.class)
	public void setterAssertionTest1(){
		new PessoaPrototype().setNome(null);
	}
	
	@Test
	public void idadeTest(){
		PessoaPrototype p = new PessoaPrototype();
		p.setDataNascimento(new CalendarDate(11,11,1990));
		p.idade();
	}
	
	@Test (expected=AssertionError.class)
	public void idadeAssertionTest1(){
		PessoaPrototype p = new PessoaPrototype();
		p.setDataNascimento(null);
		p.idade();
	}
	
	@Test
	public void cloneTest(){
		new PessoaPrototype().clone();
	}

}
